package com.goodomen.garbage.score.dto.response;

import com.goodomen.garbage.score.constant.ResponseCodeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

@ApiModel
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
@ToString
public class ResponseDto<T> {

    @ApiModelProperty(value="响应码 0:响应成功",name="code")
    private int code;
    @ApiModelProperty(value="响应消息",name="msg")
    private String msg;
    @ApiModelProperty(value="响应数据",name="data")
    private T data;

    public ResponseDto(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ResponseDto(ResponseCodeEnum codeEnum) {
        this.code = codeEnum.getCode();
        this.msg = codeEnum.getMsg();
    }

    public ResponseDto(ResponseCodeEnum codeEnum, T data) {
        this.code = codeEnum.getCode();
        this.msg = codeEnum.getMsg();
        this.data = data;
    }


}
